package o;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.gamebox.service.welfare.gift.bean.GameGiftCardBean;
import com.huawei.gamebox.service.welfare.gift.card.BaseGiftCard;
import o.exp.d;

public class fcc extends BaseGiftCard {
    private RelativeLayout ʻ;
    private boolean ʼ = false;
    private boolean ʽ = false;
    private TextView ˊ;
    private ImageView ˋ;
    private TextView ˎ;
    private ImageView ˏ;
    private boolean ॱॱ;
    private View ᐝ;

    public fcc(Context context, boolean z) {
        super(context);
        this.ॱॱ = z;
    }

    public void ॱ(boolean z) {
        this.ʼ = z;
    }

    public cgz ˏ(View view) {
        view.setBackgroundResource(exp$e.ᐝ);
        this.ʻ = (RelativeLayout) view.findViewById(d.ॱʿ);
        this.ˋ = (ImageView) view.findViewById(d.ˑ);
        this.ˊ = (TextView) view.findViewById(d.ͺॱ);
        this.ˎ = (TextView) view.findViewById(d.ˍ);
        this.ˏ = (ImageView) view.findViewById(d.ʼॱ);
        this.ᐝ = view.findViewById(d.ˋˋ);
        ((LayoutParams) this.ᐝ.getLayoutParams()).setMarginStart(view.getContext().getResources().getDimensionPixelSize(exp$a.ʿ) + epv.ˊ());
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        int i = 4;
        super.ˏ(cardBean);
        if (ˊᐝ()) {
            this.ᐝ.setVisibility(0);
        } else {
            this.ᐝ.setVisibility(4);
        }
        View view;
        if (this.ʼ) {
            view = this.ᐝ;
            if (!this.ॱॱ) {
                i = 0;
            }
            view.setVisibility(i);
        } else {
            view = this.ᐝ;
            if (ˊᐝ()) {
                i = 0;
            }
            view.setVisibility(i);
        }
        if (cardBean instanceof GameGiftCardBean) {
            GameGiftCardBean gameGiftCardBean = (GameGiftCardBean) cardBean;
            eqx.ˏ(this.ˋ, gameGiftCardBean.ॱˌ(), "app_default_icon");
            this.ˊ.setText(gameGiftCardBean.v_());
            i = gameGiftCardBean.ॱ();
            this.ˎ.setText(this.ॱ.getResources().getQuantityString(exp$g.ˏ, i, new Object[]{Integer.valueOf(i)}));
        }
        if (this.ʽ && ˎ()) {
            LayoutParams layoutParams = (LayoutParams) this.ʻ.getLayoutParams();
            layoutParams.setMargins(0, 0, 0, this.ॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ));
            this.ʻ.setLayoutParams(layoutParams);
            return;
        }
        layoutParams = (LayoutParams) this.ʻ.getLayoutParams();
        layoutParams.setMargins(0, this.ॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ), 0, this.ॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ));
        this.ʻ.setLayoutParams(layoutParams);
    }

    public void ॱ(chy o_chy) {
        OnClickListener o_fcs = new fcs(o_chy, this, 0);
        this.ˏ.setOnClickListener(o_fcs);
        ˉ().setOnClickListener(o_fcs);
    }

    public void ˎ(boolean z) {
        this.ʽ = z;
    }
}
